package com.shteo.crmd.web.api;

import com.shteo.crmd.common.source.AKResult;
import com.shteo.crmd.model.goods.Goods;
import com.shteo.crmd.web.api.fallback.GoodsServiceFallBack;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Created by Akuma on 2016/10/16.
 */
@FeignClient(name="crmd-admin-service",fallback = GoodsServiceFallBack.class)
public interface IGoodsService {

    /**
     * 添加商品
     * @param goods 商品实体
     * @return
     */
    @RequestMapping("/goods/add")
    AKResult add(@RequestBody Goods goods);

    /**
     * 查找所有商品
     * @return
     */
    @RequestMapping("/goods/get")
    List<Goods> getAllGoods();

    /**
     * 查找商品
     * @param goodsId 商品ID
     * @return
     */
    @RequestMapping("/goods/getById")
    Goods getGoodsById(@RequestParam("goodsId") Long goodsId);

    /**
     * 删除商品
     * @param goodsId 商品ID
     * @return
     */
    @RequestMapping("/goods/delById")
    AKResult delGoodsById(@RequestParam("goodsId")Long goodsId);

    /**
     * 更新商品
     * @param goods
     * @return
     */
    @RequestMapping("/goods/updateById")
    AKResult updateGoodsById(@RequestBody Goods goods);

}
